<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="cw" uri="/widget-tags"%>

<%
    String caz319 = request.getParameter("caz319");
    request.setAttribute("caz319", caz319);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>添加节假日</title>
		<cw:base />
		<script type="text/javascript" src="${pageContext.request.contextPath}/resource/scripts/formUtils.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/resource/scripts/utils.js"></script>
		<style type="text/css">
			html{overflow:hidden;}
		</style>
	</head>
	<body>
		<cw:form id="holidayForm"
			url="${pageContext.request.contextPath}/sys/addHoliday.action"
			waitMsg="提交中，请稍候...">
			<table width="100%" cellpadding="0" cellspacing="2">
				<colgroup>
					<col width='15%' align="left">
					<col width='35%' align="left">
					<col width='15%' align="left">
					<col width='35%' align="left">
				</colgroup>
				<tr height="25px">
					<td>
						年&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;度<font color=red>*</font>
					</td>
					<td>
						<cw:number id="aae001" property="aae001" label="年度"
							allowDecimals="false" required="true" allowNegative="false"
							maxLength="4" />
					</td>
					<td>
						节假日类型<font color=red>*</font>
					</td>
					<td>
						<cw:combobox id="caa202" property="caa202"
							data="${applicationScope.dic['CAA202']}" required="true"
							label="节假日类型"></cw:combobox>
					</td>
				</tr>
				<tr height="25px">
					<td>
						开始日期<font color=red>*</font>
					</td>
					<td>
						<cw:dateField id="aae030Date" property="aae030Date" format="Y-m-d"
							required="true" label="开始日期"></cw:dateField>
					</td>
					<td>
						截止日期<font color=red>*</font>
					</td>
					<td>
						<cw:dateField id="aae031Date" property="aae031Date" format="Y-m-d"
							required="true" label="截止日期"></cw:dateField>
					</td>
				</tr>
				<tr height="25px">
					<td>
						有效标志<font color=red>*</font>
					</td>
					<td>
						<cw:combobox id="aae100" property="aae100" value="1"
							data="${applicationScope.dic['AAE100']}" required="true"
							label="有效标志"></cw:combobox>
					</td>
					<td>
						&nbsp;
					</td>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr height="25px">
					<td>
						备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注
					</td>
					<td colspan="3">
						<cw:textArea id="aae013" property="aae013" height="80" width="415"></cw:textArea>
					</td>
					<cw:number id="caz319" property="caz319" type="hidden"></cw:number>
					<cw:text id="opflag" property="opflag" type="hidden" value="1"></cw:text>
				</tr>
			</table>
			<table align="center" style="margin-top: 15px;">
				<tr height="25px">
					<td>
						<cw:button text="保&nbsp;&nbsp;存" id="btn_save" onclick="doSave();"></cw:button>
					</td>
					<td>
						&nbsp;&nbsp;
					</td>
					<td>
						<cw:button text="重&nbsp;&nbsp;置" id="btn_reset"
							onclick="doReset()"></cw:button>
					</td>
					<td>
						&nbsp;&nbsp;
					</td>
					<td>
						<cw:button text="返&nbsp;&nbsp;回" id="btn_return"
							onclick="doReturn();"></cw:button>
					</td>
				</tr>
			</table>
		</cw:form>
		<cw:theme></cw:theme>

		<script type="text/javascript">
			Ext.onReady(function() {
				__WSSIP_GENERATE_GUID__();
				var caz319 = "${caz319}";
				if (caz319 != '' && caz319 != null) {
					Wonders.utils.formLoad('holidayForm',
						'${pageContext.request.contextPath}/sys/getHoliday.action', 
						{caz319 : caz319}, 
						function(form, action) {
							Ext.getCmp('opflag').setValue('2');
						}
					);
				}
			});
			
			function doSave() {
				var button = Ext.getCmp('btn_save');
				var opflag = Ext.getCmp('opflag').getValue();
				if (opflag == '2') {
					Ext.getCmp('holidayForm').url = '${pageContext.request.contextPath}/sys/updateHoliday.action';
				}else{
					Ext.getCmp('holidayForm').url = '${pageContext.request.contextPath}/sys/addHoliday.action';
				}
				Wonders.utils.formSubmit(button, 'holidayForm', function(form, action) {
					__WSSIP_GENERATE_GUID__();
					Wonders.Msg.info('保存成功', '提示', function() {
						parent.refresh_grid('holidayGrid','holiday');
						
					});
					return false;
				}, null, function(form, action) {
					__WSSIP_FAILURE_HANLDER__(form, action);
					return false;
				});
			}
			
			function doReset() {
				Ext.getCmp('holidayForm').form.reset();
				Ext.getCmp('btn_save').enable();
			}
			
			function doReturn() {
				parent.closeChildWin('holiday');
			}
		</script>
	</body>
</html>